{
  "openapi": "3.0.1",
  "info": {
    "title": "LawVu Invoices",
    "description": "Apis for invoice resources",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api-sandbox.lawvu.com/invoice-apis",
      "description": "Sandbox API"
    },
    {
      "url": "https://api.lawvu.com/invoice-apis",
      "description": "Production API"
    }
  ],
  "paths": {
    "/v1/invoices": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Get invoices",
        "operationId": "get-v1-invoices",
        "parameters": [
          {
            "name": "skip",
            "in": "query",
            "description": "The number of invoices to skip (used for paging)",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "filtering.field",
            "in": "query",
            "description": "Field to filter by (optional)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filtering.operator",
            "in": "query",
            "description": "Operator used for filtering (optional)",
            "schema": {
              "enum": [
                "eq",
                "neq",
                "lt",
                "lte",
                "gt",
                "gte",
                "startswith",
                "endswith",
                "contains",
                "doesnotcon",
                "isnull"
              ],
              "type": "string"
            }
          },
          {
            "name": "filtering.value",
            "in": "query",
            "description": "Value to filter by (optional)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sorting.direction",
            "in": "query",
            "description": "Set the sorting direction",
            "schema": {
              "enum": [
                "asc",
                "desc"
              ],
              "type": "string"
            }
          },
          {
            "name": "sorting.field",
            "in": "query",
            "description": "Set the sorting fields",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "take",
            "in": "query",
            "description": "The maximum number of invoices to return<p>Default: 50</p>",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceDataSourceResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceDataSourceResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceDataSourceResult"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invoices/{invoiceId}": {
      "patch": {
        "tags": [
          "Invoices"
        ],
        "summary": "Update invoice",
        "operationId": "patch-v1-invoices-invoiceid",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The invoice Id",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The update definition (json patch)",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/OperationArray"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationArray"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationArray"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/OperationArray"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/invoices/recipients": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Retrieve Invoice Recipients",
        "operationId": "get-v1-invoices-recipients",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BillingRecipient"
                  }
                },
                "example": [
                  {
                    "id": 1,
                    "name": "Jeff",
                    "addressLine1": "123 Sesame Street",
                    "addressLine2": "Narnia",
                    "addressLine3": "Antarctica",
                    "taxType": "GST",
                    "taxNumber": "4",
                    "contactName": "Bill",
                    "contactPhone": "17",
                    "contactEmail": "emailaddress@gmail.com"
                  },
                  {
                    "id": 2,
                    "name": "Steve",
                    "addressLine1": "124 Sesame Street",
                    "addressLine2": "South Narnia",
                    "addressLine3": "Antarctica",
                    "taxType": "TAX",
                    "taxNumber": "40",
                    "contactName": "Stan",
                    "contactPhone": "71",
                    "contactEmail": "anotheremailaddress@gmail.com"
                  }
                ]
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BillingRecipient"
                  }
                },
                "example": [
                  {
                    "id": 1,
                    "name": "Jeff",
                    "addressLine1": "123 Sesame Street",
                    "addressLine2": "Narnia",
                    "addressLine3": "Antarctica",
                    "taxType": "GST",
                    "taxNumber": "4",
                    "contactName": "Bill",
                    "contactPhone": "17",
                    "contactEmail": "emailaddress@gmail.com"
                  },
                  {
                    "id": 2,
                    "name": "Steve",
                    "addressLine1": "124 Sesame Street",
                    "addressLine2": "South Narnia",
                    "addressLine3": "Antarctica",
                    "taxType": "TAX",
                    "taxNumber": "40",
                    "contactName": "Stan",
                    "contactPhone": "71",
                    "contactEmail": "anotheremailaddress@gmail.com"
                  }
                ]
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BillingRecipient"
                  }
                },
                "example": [
                  {
                    "id": 1,
                    "name": "Jeff",
                    "addressLine1": "123 Sesame Street",
                    "addressLine2": "Narnia",
                    "addressLine3": "Antarctica",
                    "taxType": "GST",
                    "taxNumber": "4",
                    "contactName": "Bill",
                    "contactPhone": "17",
                    "contactEmail": "emailaddress@gmail.com"
                  },
                  {
                    "id": 2,
                    "name": "Steve",
                    "addressLine1": "124 Sesame Street",
                    "addressLine2": "South Narnia",
                    "addressLine3": "Antarctica",
                    "taxType": "TAX",
                    "taxNumber": "40",
                    "contactName": "Stan",
                    "contactPhone": "71",
                    "contactEmail": "anotheremailaddress@gmail.com"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/invoices/{invoiceId}/accountingCodes": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Retrieve accounting codes for an invoice.",
        "operationId": "get-v1-invoices-invoiceid-accountingcodes",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The invoice Id",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceAccountingCodes"
                },
                "example": {
                  "components": [
                    {
                      "fieldId": 18,
                      "fieldName": "Region",
                      "fieldType": "Region",
                      "optionId": 623,
                      "optionLabel": "AMER - Americas",
                      "optionCode": "AMER"
                    },
                    {
                      "fieldId": 17,
                      "fieldName": "Department",
                      "fieldType": "Department",
                      "optionId": null,
                      "optionLabel": null,
                      "optionCode": null
                    },
                    {
                      "fieldId": 115428,
                      "fieldName": "Billing Entity",
                      "fieldType": "BillingEntity",
                      "optionId": 1681,
                      "optionLabel": "amc-global - AMC Global",
                      "optionCode": "amc-global"
                    },
                    {
                      "fieldId": 171427,
                      "fieldName": "Cost Centre",
                      "fieldType": "AccountingCode",
                      "optionId": 1779,
                      "optionLabel": "A0003 - Procurement",
                      "optionCode": "A0003"
                    },
                    {
                      "fieldId": 171428,
                      "fieldName": "Project Code",
                      "fieldType": "AccountingCode",
                      "optionId": 1783,
                      "optionLabel": "P2026-002 - New division - East Sydney",
                      "optionCode": "P2026-002"
                    }
                  ]
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceAccountingCodes"
                },
                "example": {
                  "components": [
                    {
                      "fieldId": 18,
                      "fieldName": "Region",
                      "fieldType": "Region",
                      "optionId": 623,
                      "optionLabel": "AMER - Americas",
                      "optionCode": "AMER"
                    },
                    {
                      "fieldId": 17,
                      "fieldName": "Department",
                      "fieldType": "Department",
                      "optionId": null,
                      "optionLabel": null,
                      "optionCode": null
                    },
                    {
                      "fieldId": 115428,
                      "fieldName": "Billing Entity",
                      "fieldType": "BillingEntity",
                      "optionId": 1681,
                      "optionLabel": "amc-global - AMC Global",
                      "optionCode": "amc-global"
                    },
                    {
                      "fieldId": 171427,
                      "fieldName": "Cost Centre",
                      "fieldType": "AccountingCode",
                      "optionId": 1779,
                      "optionLabel": "A0003 - Procurement",
                      "optionCode": "A0003"
                    },
                    {
                      "fieldId": 171428,
                      "fieldName": "Project Code",
                      "fieldType": "AccountingCode",
                      "optionId": 1783,
                      "optionLabel": "P2026-002 - New division - East Sydney",
                      "optionCode": "P2026-002"
                    }
                  ]
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceAccountingCodes"
                },
                "example": {
                  "components": [
                    {
                      "fieldId": 18,
                      "fieldName": "Region",
                      "fieldType": "Region",
                      "optionId": 623,
                      "optionLabel": "AMER - Americas",
                      "optionCode": "AMER"
                    },
                    {
                      "fieldId": 17,
                      "fieldName": "Department",
                      "fieldType": "Department",
                      "optionId": null,
                      "optionLabel": null,
                      "optionCode": null
                    },
                    {
                      "fieldId": 115428,
                      "fieldName": "Billing Entity",
                      "fieldType": "BillingEntity",
                      "optionId": 1681,
                      "optionLabel": "amc-global - AMC Global",
                      "optionCode": "amc-global"
                    },
                    {
                      "fieldId": 171427,
                      "fieldName": "Cost Centre",
                      "fieldType": "AccountingCode",
                      "optionId": 1779,
                      "optionLabel": "A0003 - Procurement",
                      "optionCode": "A0003"
                    },
                    {
                      "fieldId": 171428,
                      "fieldName": "Project Code",
                      "fieldType": "AccountingCode",
                      "optionId": 1783,
                      "optionLabel": "P2026-002 - New division - East Sydney",
                      "optionCode": "P2026-002"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AccountingCodeComponent": {
        "type": "object",
        "properties": {
          "fieldId": {
            "type": "integer",
            "format": "int32"
          },
          "fieldName": {
            "type": "string",
            "nullable": true
          },
          "fieldType": {
            "enum": [
              "ShortText",
              "LongText",
              "Slider",
              "Currency",
              "Decimal",
              "Checkbox",
              "Date",
              "Dropdown",
              "Department",
              "Region",
              "BillingMethod",
              "BillingIntention",
              "Priority",
              "ContractEntity",
              "ConflictCheck",
              "CheckboxList",
              "RadioGroup",
              "SectionHeader",
              "ContractOwner",
              "Restricted",
              "List",
              "InvoiceRecipient",
              "User",
              "Lookup",
              "BillingEntity",
              "AccountingCode"
            ],
            "type": "string",
            "description": "<p>Options:</p><ul><li>ShortText</li><li>LongText</li><li>Slider</li><li>Currency</li><li>Decimal</li><li>Checkbox</li><li>Date</li><li>Dropdown</li><li>Department</li><li>Region</li><li>BillingMethod</li><li>BillingIntention</li><li>Priority</li><li>ContractEntity</li><li>ConflictCheck</li><li>CheckboxList</li><li>RadioGroup</li><li>SectionHeader</li><li>ContractOwner</li><li>Restricted</li><li>List</li><li>Lookup</li><li>InvoiceRecipient</li><li>User</li><li>BillingEntity</li><li>AccountingCode</li></ul>"
          },
          "optionId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "optionLabel": {
            "type": "string",
            "nullable": true
          },
          "optionCode": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BillingRecipient": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "addressLine1": {
            "type": "string",
            "nullable": true
          },
          "addressLine2": {
            "type": "string",
            "nullable": true
          },
          "addressLine3": {
            "type": "string",
            "nullable": true
          },
          "taxType": {
            "enum": [
              "GST",
              "TAX",
              "VAT"
            ],
            "type": "string",
            "description": "<p>Options:</p><ul><li>GST</li><li>TAX</li><li>VAT</li></ul>",
            "nullable": true
          },
          "taxNumber": {
            "type": "string",
            "nullable": true
          },
          "contactName": {
            "type": "string",
            "nullable": true
          },
          "contactPhone": {
            "type": "string",
            "nullable": true
          },
          "contactEmail": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "Invoice": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "invoiceNo": {
            "type": "string",
            "nullable": true
          },
          "invoiceDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "dueDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "disbursements": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "fees": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "otherFees": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "fileId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "fileName": {
            "type": "string",
            "nullable": true
          },
          "batchId": {
            "type": "integer",
            "format": "int32"
          },
          "thirdParty": {
            "type": "boolean"
          },
          "paid": {
            "type": "boolean",
            "nullable": true
          },
          "paidDateUtc": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "paymentNote": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "matterId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "approvedDateUtc": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "purchaseOrderNo": {
            "type": "string",
            "nullable": true
          },
          "totalTax": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "approvedFees": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "postedDateUtc": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "internalNotes": {
            "type": "string",
            "nullable": true
          },
          "billingPeriodStart": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "billingPeriodEnd": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "serviceProviderName": {
            "type": "string",
            "nullable": true
          },
          "serviceProviderId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "InvoiceAccountingCodes": {
        "type": "object",
        "properties": {
          "components": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountingCodeComponent"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "InvoiceDataSourceResult": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Invoice"
            },
            "description": "Represents a single page of processed data.",
            "nullable": true
          },
          "total": {
            "type": "integer",
            "description": "The total number of records available.",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "Operation": {
        "type": "object",
        "properties": {
          "value": {
            "type": "object",
            "nullable": true
          },
          "path": {
            "type": "string",
            "nullable": true
          },
          "op": {
            "type": "string",
            "nullable": true
          },
          "from": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OperationArray": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Operation"
        }
      }
    }
  }
}